<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<div style="font-family: courier;font-size: 12px;">
<table>
<c:forEach items="${importFileInfo }" var="entry">
	<tr>
		<td>${entry.key } : </td><td style="text-align: right;"> <strong>${entry.value }</strong></td>
	</tr>
</c:forEach>
</table>

<c:if test="${importFileContent != null }">
<table>
<c:forEach items="${importFileContent }" var="extractions">
	<c:if test="${extractions.key == 'RNAExtractions' }">
		<div style="font-size: 14px;">RNA EXTRACTIONS</div>
		<table cellpadding="4" >
		<tr style="font-weight: bold;">
		<td class="shead">tissue</td>
		<td class="shead">experimenter</td>
		<td class="shead">Date</td>
		<td class="shead">quantity tissue left after extraction</td>
		<td class="shead">method</td>
		<td class="shead">empty tube</td>
		<td class="shead">do260/do280</td>
		<td class="shead">final volume</td>
		<td class="shead">concentration</td>
		<td class="shead">quantity extracted</td>
		<td class="shead">quality gel</td>
		<td class="shead">agilent date</td>
		<td class="shead">agilent 28S/18S</td>
		<td class="shead">comment</td>
		<td class="shead">Import ?</td>
		</tr>
		<c:forEach items="${extractions.value }" var="extraction">
			<tr style="text-align: center;">
			<td class="srow">${extraction.tissueManipulated}</td>
			<td class="srow">${extraction.experimenter.initials }</td>
			<td class="srow"><fmt:formatDate value="${extraction.manipulationDate}" pattern="yyyy-MM-dd"/> </td>
			<td class="srow">${extraction.quantityTissueLeftAfterManipulation }</td>
			<td class="srow">${extraction.extractionMethod }</td>
			<td class="srow">
				<c:if test="${extraction.emptyTube }" >
					YES
				</c:if>
				<c:if test="${!extraction.emptyTube }" >
					NO
				</c:if>
			</td>
			<td class="srow">${extraction.do260do280 }</td>
			<td class="srow">${extraction.finalVolume }</td>
			<td class="srow">${extraction.concentration }</td>
			<td class="srow">${extraction.quantityExtracted }</td>
			<td class="srow">${extraction.qualityExtractionGel}</td>
			<td class="srow">${extraction.agilentDate }</td>
			<td class="srow">${extraction.agilent28S18S }</td>
			<td class="srow">${extraction.extractionComment }</td>
			<td><input type="checkbox" checked="checked"/></td>
			</tr>
			
			<!-- LOOP OVER DUPLICATE RNA EXTRACTIONS -->
			<c:forEach items="${ importFileContentDuplicates['RNAExtractions']}" var="extractionWithDuplicates">
				<c:if test="${extractionWithDuplicates.key.tissueManipulated == extraction.tissueManipulated &&
								 extractionWithDuplicates.key.concentration == extraction.concentration && 
								 extractionWithDuplicates.key.manipulationDate == extraction.manipulationDate}">
				<c:forEach items="${extractionWithDuplicates.value }" var="duplicate">
					<tr style="text-align: center;background-color: #D4D4D4;">
					<td style="font-weight: bold;color: red;" class="srow">${duplicate.tissueManipulated}</td>
					<td class="srow">${duplicate.experimenter.initials }</td>
					<td style="font-weight: bold;color: red;"  class="srow"><fmt:formatDate value="${duplicate.manipulationDate}" pattern="yyyy-MM-dd"/> </td>
					<td class="srow">${duplicate.quantityTissueLeftAfterManipulation }</td>
					<td class="srow">${duplicate.extractionMethod }</td>
					<td class="srow">
						<c:if test="${duplicate.emptyTube }" >YES</c:if>
						<c:if test="${!duplicate.emptyTube }" >NO</c:if>
					</td>
					<td class="srow">${duplicate.do260do280 }</td>
					<td class="srow">${duplicate.finalVolume }</td>
					<td style="font-weight: bold;color: red;"  class="srow">${duplicate.concentration }</td>
					<td class="srow">${duplicate.quantityExtracted }</td>
					<td class="srow">${duplicate.qualityExtractionGel}</td>
					<td class="srow">${duplicate.agilentDate }</td>
					<td class="srow">${duplicate.agilent28S18S }</td>
					<td class="srow">${duplicate.extractionComment }</td>
					<td class="srow"></td>
					</tr>
				</c:forEach>
				<tr height="10px"></tr>
				</c:if>
			</c:forEach>
		</c:forEach>
		</table>
	</c:if>
	<c:if test="${extractions.key == 'DNAExtractions' }">
		<div style="font-size: 14px">DNA EXTRACTIONS</div>
		<table  cellpadding="4">
		<tr style="font-weight: bold;">
		<td class="shead">tissue</td>
		<td class="shead">experimenter</td>
		<td class="shead">Date</td>
		<td class="shead">quantity tissue left after extraction</td>
		<td class="shead">empty tube</td>
		<td class="shead">final volume</td>
		<td class="shead">concentration</td>
		<td class="shead">quantity extracted</td>
		<td class="shead">quality gel</td>
		<td class="shead">comment</td>
		<td class="shead">Import ?</td>
		</tr>
		<c:forEach items="${extractions.value }" var="extraction">
		<tr style="text-align: center;">
			<td class="srow">${extraction.tissueManipulated}</td>
			<td class="srow">${extraction.experimenter.initials }</td>
			<td class="srow"><fmt:formatDate value="${extraction.manipulationDate}" pattern="yyyy-MM-dd"/> </td>
			<td class="srow">${extraction.quantityTissueLeftAfterManipulation }</td>
			<td class="srow">
				<c:if test="${extraction.emptyTube }" >
					YES
				</c:if>
				<c:if test="${!extraction.emptyTube }" >
					NO
				</c:if>
			</td>
			<td class="srow">${extraction.finalVolume }</td>
			<td class="srow">${extraction.concentration }</td>
			<td class="srow">${extraction.quantityExtracted }</td>
			<td class="srow">${extraction.qualityExtractionGel}</td>
			<td class="srow">${extraction.extractionComment }</td>
			<td><input class="confimDNAExtractionImport" id="${extraction }" type="checkbox" checked="checked"/></td>
		</tr>
		
		<!-- LOOP OVER DUPLICATE DNA EXTRACTIONS -->
		<c:forEach items="${ importFileContentDuplicates['RNAExtractions']}" var="extractionWithDuplicates">
			<c:if test="${extractionWithDuplicates.key.tissueManipulated == extraction.tissueManipulated &&
							 extractionWithDuplicates.key.concentration == extraction.concentration && 
							 extractionWithDuplicates.key.manipulationDate == extraction.manipulationDate}">
			<c:forEach items="${extractionWithDuplicates.value }" var="duplicate">
				<tr class="error" style="text-align: center;">
				<td style="font-weight: bold;color: red;" class="srow">${duplicate.tissueManipulated}</td>
				<td class="srow">${duplicate.experimenter.initials }</td>
				<td style="font-weight: bold;color: red;" class="srow"><fmt:formatDate value="${duplicate.manipulationDate}" pattern="yyyy-MM-dd"/> </td>
				<td class="srow">${duplicate.quantityTissueLeftAfterManipulation }</td>
				<td class="srow">
					<c:if test="${duplicate.emptyTube }" >YES</c:if>
					<c:if test="${!duplicate.emptyTube }" >NO</c:if>
				</td>
				<td class="srow">${duplicate.finalVolume }</td>
				<td style="font-weight: bold;color: red;" class="srow">${duplicate.concentration }</td>
				<td class="srow">${duplicate.quantityExtracted }</td>
				<td class="srow">${duplicate.qualityExtractionGel}</td>
				<td class="srow">${duplicate.extractionComment }</td>
				<td class="srow"></td>
				</tr>
			</c:forEach>
			</c:if>
		</c:forEach>
		
		</c:forEach>
		</table>
	</c:if>
</c:forEach>
</table>
</c:if>
<c:if test="${importError!=null }">
<div style="color: red">
${importError}
</div>
</c:if>

</div>